//
//  HotAnchorTableViewCell.m
//  LOL视频播放
//
//  Created by 花花蔡 on 2016/12/9.
//  Copyright © 2016年 com.HuaHuaCai. All rights reserved.
//

#import "HotAnchorTableViewCell.h"
#import "Public.h"
#import "UIImageView+WebCache.h"
@interface HotAnchorTableViewCell ()

@property(nonatomic,strong) UIImageView *shotImageView;
@property(nonatomic,strong) UILabel *titleNameLabel;
@property(nonatomic,strong) UILabel *updateTimeLabel;
@property(nonatomic,strong) UILabel *videoLengthLabel;


@end

@implementation HotAnchorTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

+(instancetype)loadCellWithTableView:(UITableView *)tableView {
    
    static NSString *cellIdent = @"oioio";
    
    HotAnchorTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdent];
    
    if (!cell) {
        cell = [[HotAnchorTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdent];
    }
    return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setModel:(HotAnchorModel *)model {
    [_shotImageView sd_setImageWithURL:[NSURL URLWithString:model.P] placeholderImage:[UIImage imageNamed:@"占位图"]];
    _titleNameLabel.text = model.N;
    _updateTimeLabel.text = [model.T stringByReplacingOccurrencesOfString:@"T" withString:@""];
    _videoLengthLabel.text = [NSString stringWithFormat:@"视频:%@",model.V];
}

- (void)setupUI {
    
    _shotImageView = [[UIImageView alloc]initWithFrame:CGRectMake(6*KWidth_ScaleW, 6*KWidth_ScaleW, 98*KWidth_ScaleW, 98*KWidth_ScaleW)];
    _shotImageView.backgroundColor = [UIColor grayColor];
    _shotImageView.layer.cornerRadius = 7;
    _shotImageView.layer.masksToBounds = YES;
    [self.contentView addSubview:_shotImageView];
    
    _titleNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(116 * KWidth_ScaleW, 0, screen_width - 120 *KWidth_ScaleW, 67 *KWidth_ScaleW)];
    _titleNameLabel.numberOfLines = 0;
    _titleNameLabel.font = [UIFont systemFontOfSize:24 * KWidth_ScaleW];
    [self.contentView addSubview:_titleNameLabel];
    
    _updateTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(116 * KWidth_ScaleW, 86 * KWidth_ScaleW, screen_width - 240 * KWidth_ScaleW, 18 * KWidth_ScaleW)];
    _updateTimeLabel.textColor = [UIColor grayColor];
    _updateTimeLabel.font = [UIFont systemFontOfSize:17 * KWidth_ScaleW];
    [self.contentView addSubview:_updateTimeLabel];
    
    _videoLengthLabel = [[UILabel alloc] initWithFrame:CGRectMake(screen_width - 104 *KWidth_ScaleW, 86 * KWidth_ScaleW, 104 *KWidth_ScaleW, 18 * KWidth_ScaleW)];
    _videoLengthLabel.font = [UIFont systemFontOfSize:17 * KWidth_ScaleW];
    [self.contentView addSubview:_videoLengthLabel];
    
//    _titleNameLabel.text = @"Test ------- Test ------- Test";
//    _updateTimeLabel.text = @"TIME TIME";
//    _videoLengthLabel.text = @"视频:120";

}

















@end
